package com.hetao.xx.service;

import android.content.Context;
import android.content.SharedPreferences;

import com.hetao.xx.Global;

public class SpService {

    public static SharedPreferences getSharedPreferences(String name) {
        return Global.getInstant().getApplication().getSharedPreferences(name, Context.MODE_PRIVATE);
    }


    public static SharedPreferences getUserSp() {
        return getSharedPreferences("user");
    }

    public static String loadStringOnUser(String key) {
        SharedPreferences sp = getUserSp();
        return sp.getString(key, null);
    }

    public static boolean saveStringOnUser(String key, String value) {
        SharedPreferences sp = getUserSp();
        SharedPreferences.Editor editor = sp.edit();
        editor.putString(key, value);
        return editor.commit();
    }

}
